<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="layout">
<head>
<title>商品属性管理</title>
</head>
<body>
	<div layout:fragment="content">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group pull-right">
					<a href="index.html" th:href="@{/goods/attribute/index}"
						id="Link_cancel" class="btn green">返回<i
						class="fa fa-arrow-circle-o-left"></i></a>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<div class="form">
					<form role="form" th:action="@{/goods/attribute/save}"
						th:object="${attribute}" method="post" class="form-horizontal" id="form_attribute_check">
						<h4 class="form-section">商品属性基本信息</h4>
						<input type="hidden" th:field="*{id}" />
						<div class="form-body">
							<div class="form-group"
								th:class="${#fields.hasErrors('name')}? 'form-group has-error' : 'form-group'">
								<label class="control-label col-md-3">属性名称<span
									class="required" aria-required="true">* </span></label>
								<div class="col-md-4">
									<input type="text" class="form-control" placeholder="属性名称"
										th:field="*{name}" maxlength="10" id="attribute_name"/> <span class="help-block"
										th:if="${#fields.hasErrors('name')}" th:errors="*{name}">属性名称不能为空</span>
								</div>
							</div>
							<div class="form-group">
								<label class="control-label col-md-3">可选类型<span
									class="required" aria-required="true">* </span></label>
								<div class="col-md-9">
									<div class="radio-list">
										<label class="radio-inline"
											th:each="eachValue : ${selectTypes}"> <span><input
												th:field="*{selectType}" type="radio" name="selectType"
												th:value="${eachValue}" th:text="${eachValue.description}" id="attribute_selectType"/></span></label>
									</div>
								</div>
							</div>
							
							<div class="form-group" th:class="${#fields.hasErrors('attributeSort')}? 'form-group has-error' : 'form-group'">
								<label class="control-label col-md-3">排序<span class="required" aria-required="true">* </span></label>
								<div class="col-md-4">
									<input type="text" class="form-control" placeholder="排序" th:field="*{attributeSort}" maxlength="10" id="attribute_sort" />
									 <span class="help-block" th:if="${#fields.hasErrors('attributeSort')}" th:errors="*{attributeSort}">排序不能为空</span>	
								</div>
							</div>

							<!-- <div class="form-group">
								<label class="control-label col-md-3">录入方式<span
									class="required" aria-required="true">* </span></label>
								<div class="col-md-9">
									<div class="radio-list">
										<label class="radio-inline"
											th:each="eachValue : ${inputModes}"> <span> <input
												th:field="*{inputMode}" type="radio" name="inputMode"
												th:value="${eachValue}" th:text="${eachValue.description}" id="attribute_inputMode"/></span></label>
									</div>
								</div>
							</div>
 -->
							<div class="form-group"
								th:class="${#fields.hasErrors('inputValues')}? 'form-group has-error' : 'form-group'">
								<label class="control-label col-md-3">可选值<span
									class="required" aria-required="true">* </span></label>
								<div class="col-md-4">
									<textarea class="form-control" rows="3" placeholder="可选值"
										th:field="*{inputValues}" id="attribute_inputValue" name="attribute_inputValue"></textarea>
									<span class="help-block"
										th:if="${#fields.hasErrors('inputValues')}"
										th:errors="*{inputValues}">可选值不能为空</span>
								</div>
							</div>
						</div>
						<div class="form-actions fluid">
							<div class="col-md-offset-3 col-md-9">
								<button type="submit" class="btn blue" id="bt_submit" name="button_submit">提交</button>
								<!-- <a href="index.html" th:href="@{/goods/attribute/index}" id="button_return" class="btn blue">返回</a> -->
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
</html>


<script th:inline="javascript">
	/*<![CDATA[*/
	
$(document).ready(function(){

		 $("#form_attribute_check").validate({
	         rules:{
	             name:{
	            	 required:true,
	            	 maxlength:10
	             },
	             selectType:{
	            	 required:true,
	             },
	             attributeSort:{
	            	 required:true,
	            	 number:true,
					 max:254	
	             },
	             inputValues:{
	                 required:true,
	                 maxlength:10000
	             }
	             
	             
	              
	         },
	         messages:{
	             name:{
	                 required:"请输入属性名称",
	                 maxlength:'商品名称长度不可超过10'
	             }
	         }
	         
	     });
		 
		 



	});


	
	/*]]>*/
</script>